﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>企业新增</title>
</head>
<body class="layui-padding-3">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">企业全称</label>
            <div class="layui-input-block">
                <input type="text" name="EnterpriseName" lay-verify="required" placeholder="请输入企业全称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">企业简称</label>
            <div class="layui-input-block">
                <input type="text" name="EnterpriseSname" lay-verify="required" placeholder="请输入企业简称" autocomplete="off" class="layui-input">
            </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label">行业标签</label>
            <div class="layui-input-block">
                <input type="text" name="EnterpriseLabel" lay-verify="required" placeholder="请输入行业标签" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">详细地址</label>
            <div class="layui-input-block">
                <input type="text" name="EnterpriseHome" lay-verify="required" placeholder="请输入详细地址" autocomplete="off" class="layui-input">
            </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label">企业电话</label>
            <div class="layui-input-block">
                <input type="text" name="EnterprisePhone" lay-verify="required" placeholder="请输入企业电话" autocomplete="off" class="layui-input">
            </div>
        </div>
         <div class="layui-form-item">
            <label class="layui-form-label">统一社会信用代码</label>
            <div class="layui-input-block">
                <input type="text" name="EnterpriseUsci" lay-verify="required" placeholder="请输入统一社会信用代码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <input type="text" name="EnterpriseDescribe" lay-verify="required" placeholder="请输入描述" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>

    </form>
    
</body>
</html>
<script>

    layui.use(['form', 'laydate', 'util'], function () {
        var form = layui.form;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var util = layui.util;

        // 提交事件
        form.on('submit(demo1)', function (data) {
            var field = data.field; // 获取表单字段值
            field.State = 0;
            console.log(field);
            $.ajax({
                url: '@ViewBag.FoundationWrite'+ "/api/Jocker/EnterpriseAdd",
                data: JSON.stringify(field),
                type: "post",
                contentType: "application/json",
                success: function (res) {
                    console.log(res);
                    if (res > 0) {
                        layer.alert("添加成功", {
                            title: '/Jocker/EnterpriseList'
                        });
                    }
                    else {
                        alert('提交失败')
                    }
                }
            })
            
            return false; 
        });
    });



   
           
    
</script>